<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增【请填写功能名称】')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-monitor-add">
        <div class="form-group">
            <label class="col-sm-3 control-label">维护单位：</label>
            <div class="col-sm-8">
                <select name="maintainBy" class="form-control" id="maintainBy"  style="width: 60%"></select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">监测点MN编号：</label>
            <div class="col-sm-8">
                <input name="mnCode" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">监测点名称：</label>
            <div class="col-sm-8">
                <input name="monitorName" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">河道名称：</label>
            <div class="col-sm-8">
                <input name="riverName" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">所在街道：</label>
            <div class="col-sm-8">
                <input name="street" class="form-control" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">所在片区：</label>
            <div class="col-sm-8">
                <select name="parentOrg" class="form-control"   id="parentOrg"  style="width: 60%">
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">监测点坐标：</label>
            <div class="col-sm-8">
                <input name="lngLat" class="form-control" type="text">
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "bus/monitor"
    $("#form-monitor-add").validate({
        focusCleanup: true
    });
    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/add", $('#form-monitor-add').serialize());
        }
    }

    $(document).ready(function(){
        loadDepartenterprise();
    });
    function loadDepartenterprise() {
        $.ajax({
            url: "/bus/maintain/list",
            type: "post",
            success: function (data) {
                var nameOpt = "<option value='' selected='selected'>--请选择--</option>";
                for (var i = 0; i < data.rows.length; i++) {
                    nameOpt+="<option value='"+data.rows[i].maintainId+"' >"+data.rows[i].maintainName+"</option>"
                    $('#maintainBy').html(nameOpt);
                }
            }
        });
    };

    $(document).ready(function(){
        loadDepartEnterpriseId();
    });
    function loadDepartEnterpriseId() {
        $.ajax({
            url:  "/bus/enterprise/list",
            type: "post",
            success: function (data) {
                var nameOpt = "<option value='' selected='selected'>--请选择--</option>";
                for (var i = 0; i < data.rows.length; i++) {
                    nameOpt += "<option value='" + data.rows[i].entId + "' >" + data.rows[i].entName + "</option>"
                    $('#parentOrg').html(nameOpt);
                }
            }
        });
    };
</script>



</body>
</html>